<#include "ftls/menubutton.ftl" />
<#include "ftls/spring.ftl"/>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${SystemName!'JMax'}</title>
<script type="text/javascript" src="static/jmax/js/import.js"></script>
<script type="text/javascript">
//导入首页启动时需要的相应资源文件(首页相应功能的 js 库、css样式以及渲染首页界面的 js 文件)
importJS('static/jmax/js/index.js');
// importCSS('static/jmax/css/index.css');
importJS('static/jmax/js/index-startup.js');
importJS('static/plugins/Highcharts-4.0.4/js/highcharts.js');
importCSS('static/jmax/css/jmax.css');
importCSS('static/plugins/dhtmlx/codebase/dhtmlx.css');
importJS('static/plugins/dhtmlx/codebase/dhtmlx.js');
importJS('static/hotel/js/hotel.js');
importJS('static/plugins/ckeditor/ckeditor.js');
importJS('static/plugins/swfupload/swfupload.js');
importJS('static/plugins/swfupload/swfupload.queue.js');
importJS('static/plugins/swfupload/fileprogress.js');
importJS('static/plugins/swfupload/handlers.js');
importCSS('static/plugins/swfupload/process.css');
importJS('static/cms/js/autoZoomLoadImage.js');
</script>
<link rel="shortcut icon" href="${faviconUrl!'static/jmax/images/favicon.png'}">
<script type="text/javascript">
	$(function() {
		var menus = ${menusJson![]};
		function createSubMenu(obj)
		{
			var url = obj.attr('data-url');
			var id = obj.attr('value');
			printLog(url);
			if(url!=''){
				$('#mainLayout').layout('collapse','west')
				var iframe = obj.attr('data-iframe');
				var menuName = obj.attr('data-text');
				var iconCls = obj.attr('data-icon');
				printLog(iframe);
				window.mainpage.clickMenuAddModelTab(id,menuName,-1,url,iconCls,iframe=='true');
			}
			else {
				$('#mainLayout').layout('expand','west')
				for(var i=0;i<menus.length ;i++)
				{
// 					printLog(menus[i].id);
					if(id==menus[i].id) {
						var subMenus = menus[i].children;
						loadSubMenuTree(subMenus);
						break;
					}
				}
			}
			
		}
		
		
		$('#systemMenu a').click(function() {
			$('#systemMenu a').removeClass('active');
			$(this).addClass('active');
			createSubMenu($(this));
		});
		
		//动态初始化首页内容 ，之前静态化，无法动态设置首页iframe嵌套   add by max 20170503
		<#if ShowHome??&&ShowHome=='true'>
			window.mainpage.clickMenuAddModelTab('homePanel','${HomeTitle!'主页'}','','${HomeHref!'main.do?homePanel'}','icon-hamburg-home',${HomeUrlIsIframe!'false'},false);
		</#if>
	});
	
	
	
	/**
	 * 加载菜单
	 */
	function loadSubMenuTree(subMenus) {
		printLog(subMenus);
// 		var menulist = [];
// 		$.each(subMenus, function(i, item) {
// 			menulist.push({
// 				id: item.id,
// 				text: item.name,
// 				attributes:item.url, 
// 				parent_id: item.parent.id,
// 				iconCls: item.icon,
// 				iframe:item.iframe
// 			});
// 		});
// 		for(var i = 0; i < menulist.length; i++) {
// 			var children = menulist[i].children || [];
// 			for(var j = 0; j < menulist.length; j++) {
// 				if(menulist[j].parent_id == menulist[i].id) {
// 					children.push(menulist[j]);
// 				}
// 			}
// 			menulist[i].children = children;
// 		}
		
		$("#subMenuTree").tree({
			data: subMenus,
			lines:true,
			onBeforeSelect: treeBeforeSelect, 
			onSelect: treeSelect,
			onExpand:function(node) {$('.tree-node').removeClass('treeExpandCls');$('#'+node.domId).addClass('treeExpandCls');},
			onCollapse:function(node) {$('.tree-node').removeClass('treeExpandCls');$('#'+node.domId).removeClass('treeExpandCls')}
		});
	}
	
	/**
	 * 菜单事件
	 */
	function treeBeforeSelect(node) {
// 		var leaf = $(this).tree('isLeaf', node.target);
// 		printLog(leaf);
	    if(node.children && node.children.length > 0) {
	        if(node.state == "open") {
	            $(this).tree("collapse", node.target);
	        }else {
	            $(this).tree("expand", node.target);
	        }
	        return false;
	    } 
	}
	/**
	 * 菜单事件
	 */
	function treeSelect(node) {
		printLog(node);
		window.mainpage.clickMenuAddModelTab(node.id,node.text,node.parent.id,node.url,node.iconCls,node.iframe);
	}

	/**
	 * 全屏
	 */
	function fullScreen() {
		if($("#fullScreen").find(".glyphicon-screenshot").length > 0) {
			$("#layout").layout('expand', 'west').layout('expand', 'north');
			$("#fullScreen").find(".l-btn-icon").addClass("glyphicon-fullscreen").removeClass("glyphicon-screenshot");
		}else {
			$("#layout").layout('collapse', 'north').layout('collapse', 'west');
			$("#fullScreen").find(".l-btn-icon").addClass("glyphicon-screenshot").removeClass("glyphicon-fullscreen");
			$(".layout-expand").hide();
		}
		
	}
</script>
<style>
#submenus {
/* 	padding: 1px; */
/* 	width:7px; */
	background-color:#474b4f;
	color: #ffffff;
}
#submenus a {
	background-color:#474b4f;
}
#submenus a:hover {
	background-color:#4d5053;
}

#submenus a.l-btn-large {
	background-color:#4d5053;
}

#submenus a span{
	background-color:#4d5053;
}
#submens a span.l-btn-icon-top {
	width:100%;
}
#mainTabs .easyui-tabs .tabs li a.tabs-inner{border-radius: 2px 2px 0 0;}
#mainTabs .tabs li.tabs-selected * {
    color: #0099CC;
}
#mainTabs .tabs li.tabs-selected a.tabs-inner {
    border: 1px solid #0099CC;
    border-bottom: 1px solid #fff;
}
#subMenuTree .tree-node {padding: 8px 0px;}
#subMenuTree .tree-node-hover{background: #465467; color: white;}
#subMenuTree .tree-node-selected{color: white;}
#subMenuTree .tree-node .tree-title{font-size: 13px; font-weight: normal; color: #fff; }
#subMenuTree .treeExpandCls{background:#465467;}


.menu_head {
    height: 30px;
    line-height: 30px;
    background: #4e5f77;
    color: #aeb9c2;
    text-align: center;
}
#subMenuTree .tree-expanded{
/*     background:no-repeat -18px 0px; */
    
}
#subMenuTree .tree-collapsed {
/*     background:no-repeat 0px 0px; */
}
#subMenuTree .tree-icon {
    color: #BFBFBF;
    font-size: 12px;
    line-height: 18px;
}
</style>
</head>
<body>
    <div id="mainLayout" class="easyui-layout hidden" data-options="fit: true">
        <div id="northPanel" data-options="region: 'north', border: false" style="height: 62px; overflow: hidden;">
            <div class="top-bar">
				<div class="top-bar-left">
					<#if SystemName??>
						<#if SystemName=='JMax'>
						<a href="main.do?main">
							<img src="static/jmax/images/jmax-logo.png" border="0" align="absmiddle" />
						</a>
						<#else>
						<a href="" style="font-size: 25px;text-decoration: none;position: relative;left: 20px;top: 14px;font-weight: bold;color: #b5deff;">
							${SystemName!}
						</a>
						</#if>
					</#if>
				</div>
				<div class="top-bar-menu">
					<!-- 一级模块菜单 -->
					<#include "systemMenu.html">
				</div>
				<div class="top-bar-right">
						<em style="padding-right: 10px;font-style: normal;color: #FFFFFF;">欢迎 ${user.name!}</em>
						<span>
<!-- 							<a id="userInfo" title="个人信息" href="javascript:void(0)"><img -->
<!-- 									src="static/jmax/images/me.png" name="Image1" border="0" -->
<!-- 									align="top" id="Image1" -->
<!-- 									onmouseover="$(this).attr('src','static/jmax/images/me1.png')" -->
<!-- 									onmouseout="$(this).attr('src','static/jmax/images/me.png')"></a> -->
							<a id="btnUpdatePwd" title="更改密码" href="javascript:void(0)"><img
									src="static/jmax/images/me.png" name="Image1" border="0"
									align="top" id="Image1"
									onmouseover="$(this).attr('src','static/jmax/images/me1.png')"
									onmouseout="$(this).attr('src','static/jmax/images/me.png')"></a>
									
							<#if AboutPlatform??&&AboutPlatform='true'>
								<a id="btnContact" title="关于" href="javascript:void(0)"> <img
									src="static/jmax/images/about.png" name="Image2" border="0"
									align="top" id="Image2"
									onmouseover="$(this).attr('src','static/jmax/images/about1.png')"
									onmouseout="$(this).attr('src','static/jmax/images/about.png')">
								</a>
							</#if>
							<a id="btnExit" title="注销" href="javascript:void(0)"> <img
									src="static/jmax/images/logout.png" name="Image3" border="0"
									align="top" id="Image3"
									onmouseover="$(this).attr('src','static/jmax/images/logout1.png')"
									onmouseout="$(this).attr('src','static/jmax/images/logout.png')">
							</a>
					</span>
				</div>
			</div>
        </div>
		<div id="mainWest" data-options="region:'west',split:false, border:false,collapsed:true" style="width:240px;background-color: #3f4245;color:white;">
			<div class="panel-header panel-header-noborder" style="width: 230px;border-color:#3f4245;background: #4e5f77;color: #aeb9c2;text-align: center;">
				<div class="panel-title" style="background-color: #4e5f77;color: #ffffff;font-size: 14px;">菜单导航</div>
				<div class="panel-tool">
					<a class="panel-tool-collapse" href="javascript:void(0)"
						style="display: none;"></a>
					<a href="javascript:void(0)" onclick="$('#mainLayout').layout('collapse','west')" class="layout-button-left"></a>
				</div>
			</div>
			<ul id="subMenuTree"></ul>
		</div>
        <div data-options="region: 'center'" style="padding: 1px;">
            <div id="mainTabs" class="easyui-tabs"  data-options="fit: true, border: true, showOption: true, enableNewTabMenu: true, tools: '#mainTabsTools', enableJumpTabMenu: true, onSelect: function (title, index) { window.mainpage.mainTabs.updateHash(index); }">
                <#if ShowHome??&&ShowHome=='true'>
<!--                 <div id="homePanel" data-options="title: '${HomeTitle!'主页'}', iconCls: 'icon-hamburg-home',href:'${HomeHref!'main.do?homePanel'}'""> -->
                    
<!--                 </div> -->
                </#if>
            </div>
        </div>

<!--         <div data-options="region: 'east', title: '日历', iconCls: 'icon-standard-date', split: false,collapsed: true,  minWidth: 200, maxWidth: 500" style="width: 220px; padding: 1px; border-left-width: 0px;"> -->
<!--             <div id="eastLayout" class="easyui-layout" data-options="fit: true"> -->
<!--                 <div data-options="region: 'north', split: false, border: false" style="height: 220px;"> -->
<!--                     <div class="easyui-calendar" data-options="fit: true"></div> -->
<!--                 </div> -->
<!--                 <div id="linkPanel" data-options="region: 'center', title: '友情链接', iconCls: 'icon-hamburg-link', tools: [{ iconCls: 'icon-hamburg-refresh', handler: function () { window.link.reload(); } }]"> -->
<!--                     <ul id="linkList" class="portlet-list link-list"> -->
<!-- 						<li> -->
<!-- 							<span style="font-weight: bold;">作者(Max)</span> <br /> -->
<!-- 							<a href="http://java4ever.iteye.com" target="_blank">http://java4ever.iteye.com</a> -->
<!-- 						</li> -->
<!-- 					</ul> -->
<!--                 </div> -->
<!--             </div> -->
<!--         </div> -->

<!--         <div data-options="region: 'south', title: '关于...', iconCls: 'icon-standard-information', collapsed: true, border: false" style="height: 70px;"> -->
<!--             <div style="color: #4e5766; padding: 6px 0px 0px 0px; margin: 0px auto; text-align: center; font-size:12px; font-family:微软雅黑;"> -->
<!--                 @2013-2016 Copyright Max <a href="mailto:358744287@qq.com" target="_blank" style="text-decoration: none;">358744287@qq.com</a>&nbsp;&nbsp;|&nbsp;&nbsp; -->
<!--                 <a href="http://www.jmax4you.com/jmax/portal.action?index" target="_blank" style="text-decoration: none;">关于JMax</a><br /> -->
<!--                 建议使用&nbsp; -->
<!--                 <a href="http://windows.microsoft.com/zh-CN/internet-explorer/products/ie/home" target="_blank" style="text-decoration: none;">IE(Version 9/10/11)</a>/ -->
<!--                 <a href="https://www.google.com/intl/zh-CN/chrome/browser/" target="_blank" style="text-decoration: none;">Chrome</a>/ -->
<!--                 <a href="http://firefox.com.cn/download/" target="_blank" style="text-decoration: none;">Firefox</a> -->
<!--                 &nbsp;系列浏览器。 -->
<!--             </div> -->
<!--         </div> -->


    </div>
    
    <div id="mainTabsTools" style="border: 0px; border-bottom: 1px solid #D3D3D3;">
         <a id="btnFullScreen" class="easyui-linkbutton" data-options="plain: true, iconCls: 'icon-standard-arrow-inout'">全屏切换</a>
	</div>
</body>
</html>
